package com.lingyistudio.user.entity;

import com.lingyistudio.common.entity.BaseEntity;
import lombok.Data;

/**
 * @ClassName: UserEntityBackendTOFront
 * @Description:
 * @Author: cheng
 * @Date: 2019/5/26
 */
@Data
public class UserEntityBackendTOFront extends BaseEntity {
    private String userId;//用户唯一标识
    private String userNumber; //用户账号
    private String userPassword ;//用户密码
    private String userName; //用户姓名
    private String userReal; //用户昵称
    private String userIdentity; //用户身份证号
    private String userEmail; //用户电子邮箱
    private int userSex; //性别,
    private String userMobilephone;  //手机号
    private String userPhone; //固定电话
    private String userImg; //用户头像

    public void setuserIdentity(String str){
        if(str==null){
            return;
        }
        String temp="";
        for(int i=3;i<( str.length()-3 );i++){
            temp = temp + "*";
        }
        this.userIdentity = str.substring(0,3)+temp+str.substring(str.length()-3);
    }

    public void setUserSex(int num){
        if ( num%10 == 9 ){
            this.userSex = 9;
        }else{
            this.userSex = num/10;
        }
    }

    public void setUserPassword(String str){
        this.userPassword = "******";
    }

    public UserEntityBackendTOFront(CustomerEntity customerEntity){
        this.setUserEmail(customerEntity.getCustomerEmail());
        this.setUserId(customerEntity.getCustomerId());
        this.setuserIdentity(customerEntity.getCustomerIdentity());
        this.setUserImg(customerEntity.getCustomerImg());
        this.setUserMobilephone(customerEntity.getCustomerMobilephone());
        this.setUserName(customerEntity.getCustomerName());
        this.setUserPhone(customerEntity.getCustomerPhone());
        this.setUserReal(customerEntity.getCustomerReal());
        this.setUserSex(customerEntity.getCustomerSex());//性别 : 99保密，11男，21女，19男对其他人保密，29女对其他人保密
        this.setUserPassword(customerEntity.getNewCustomerPassword());

        this.setVersion(customerEntity.getVersion());
        this.setTokenFront(customerEntity.getTokenFront());
        this.setTokenBackend(customerEntity.getTokenBackend());
        this.setLastModifiedBy(customerEntity.getLastModifiedBy());
        this.setIsUsed(customerEntity.getIsUsed());
        this.setIsDeleted(customerEntity.getIsDeleted());
        this.setGmtModified(customerEntity.getGmtModified());
        this.setGmtCreate(customerEntity.getGmtCreate());
        this.setCreatedBy(customerEntity.getCreatedBy());
    }

}
